home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / dev / lang / SmallEiffel.lha / SmallEiffel / lib_show / bench1 / bench.e < prev    next >
Text File  |  1998-12-22  |  2KB  |  61 lines

  1. --          This file is part of SmallEiffel The GNU Eiffel Compiler.
  2. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  3. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr 
  4. --                       http://www.loria.fr/SmallEiffel
  5. -- SmallEiffel is  free  software;  you can  redistribute it and/or modify it 
  6. -- under the terms of the GNU General Public License as published by the Free
  7. -- Software  Foundation;  either  version  2, or (at your option)  any  later 
  8. -- version. SmallEiffel is distributed in the hope that it will be useful,but
  9. -- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. -- or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU General Public License 
  11. -- for  more  details.  You  should  have  received a copy of the GNU General 
  12. -- Public  License  along  with  SmallEiffel;  see the file COPYING.  If not,
  13. -- write to the  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. -- Boston, MA 02111-1307, USA.
  15. --
  16. deferred class BENCH
  17.    --
  18.    -- Comparison :  ARRAY, FIXED_ARRAY, LINK_LIST and LINK2_LIST.
  19.    --
  20.  
  21. feature
  22.  
  23.    -- According to the power of your computer, set `tuning'
  24.    -- to a good positive value. Default is for very small 
  25.    -- computer :
  26.    tuning: INTEGER is 1; -- 200;
  27.  
  28. feature {NONE}
  29.  
  30.    count: INTEGER is 
  31.       do 
  32.      Result := tuning + 1;
  33.       end;
  34.  
  35.    frozen bench(cltn: COLLECTION[INTEGER]) is
  36.       require
  37.      cltn.count = count
  38.       local
  39.      inner, outer, nb_loops, value: INTEGER
  40.       do
  41.      nb_loops := tuning * tuning;
  42.      from
  43.         outer := 1;
  44.      until
  45.         outer > nb_loops
  46.      loop
  47.         from
  48.            inner := cltn.lower;
  49.         until
  50.            inner > cltn.upper
  51.         loop
  52.            value := cltn.item(inner);
  53.            cltn.put(value + 1,inner);
  54.            inner := inner + 1;
  55.         end;
  56.         outer := outer + 1
  57.      end;
  58.       end;
  59.  
  60. end -- BENCH
  61.